<% add_decidim_page_title(t("decidim.admin.titles.dashboard")) %>

<div class="item_show__header">
  <h1 class="item_show__header-title">
  <%= t "decidim.admin.titles.dashboard" %> <%= current_organization_name %>
  </h1>
</div>

<div class="content">
  <% unless current_user.admin_terms_accepted? %>
    <%= cell("decidim/announcement", announcement_body, callout_class: current_user.admin_terms_accepted? ? "success" : "warning" ) %>
  <% end %>

  <% if count_pending_moderations.positive? && allowed_to?(:read, :global_moderation) %>
    <div class="grid-x grid-margin-x">
      <div class="cell small-6 medium-6 large-6">
        <%= render "pending_moderations" %>
      </div>
    </div>
  <% end %>

  <% if allowed_to? :read, :users_statistics %>
    <div class="grid-x grid-margin-x">
      <div class="cell small-6 medium-6 large-6">
        <%= render(
          partial: "decidim/admin/users_statistics/users_count",
          locals: {
            result: users_counter
          }
        ) %>
      </div>
    </div>
  <% end %>

    <% if allowed_to? :read, :admin_log %>
      <div class="grid-x grid-margin-x">
        <div class="cell small-6 medium-6 large-6">
          <%= render partial: "decidim/admin/logs/logs_list", locals: { logs: latest_action_logs, display_filters: false } %>
          <% if latest_action_logs.any? %>
            <div class="mt-4">
              <%= link_to t(".view_more_logs"), logs_path, class: "button button__sm button__secondary" %>
            </div>
          <% end %>
        </div>
      </div>
    <% end %>

  <% if current_user.admin_terms_accepted? %>
    <%= link_to( t("title", scope: "decidim.admin.admin_terms_of_service"), admin_terms_show_path, class: "button button__text-secondary") %>
  <% end %>
</div>
